package top3.Divorce;


import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class DivorceTop3Reducer extends Reducer<DivorceTop3Bean, FloatWritable, DivorceTop3Bean,FloatWritable> {
    @Override
    protected void reduce(DivorceTop3Bean key, Iterable<FloatWritable> values, Reducer<DivorceTop3Bean, FloatWritable, DivorceTop3Bean, FloatWritable>.Context context) throws IOException, InterruptedException {
        int num = 0;
        for (FloatWritable value : values){
            if (num < 3){
                context.write(key,value);
                num++;
            }
        }
    }
}
